package com.yc.jpyy.base.config;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 获取config.properties配置文件的地址
 */
public class Config {
	private static Properties prop = null;
	static final Logger logger = LoggerFactory.getLogger(Config.class);
	/**
	 * load config
	 **/
	static {
		loadProp();
	}

	/**
	 * load the config into cache
	 **/
	public static void loadProp() {
		try {
			prop = new Properties();
			prop.load(Config.class.getClassLoader().getResourceAsStream(
					"config.properties"));
		} catch (IOException e) {
			logger.info("load config failed:" + e.getMessage());
		}
	}

	/**
	 * 获取基础信息图片地址
	 **/
	public static String getImageAddress() {
		return prop.getProperty("image.address", "");
	}
	
	/**
	 * 获取图片存储地址
	 **/
	public static String getImageURL() {
		return prop.getProperty("image.url", "");
	}
	
	/**
	 * 获取二维码比对接口url
	 **/
	public static String getCompareQRCodeUrl() {
		return prop.getProperty("compareQRCodeUrl", "");
	}
	
	/**
	 * 获取collectorurl
	 **/
	public static String getCollectorUrl() {
		return prop.getProperty("collectorUrl", "");
	}
	
	/**
	 * 获取视频、视频图片地址
	 **/
	public static String getImageStudyAddress() {
		return prop.getProperty("image.studyaddress", "");
	}
	
	 
	
	/**
	 * 获取图片保存地址
	 **/
	public static String getImageSave() {
		return prop.getProperty("image.save", "");
	}

	/**
	 * 获取文件地址
	 **/
	public static String getZSFile() {
		return prop.getProperty("image.zs", "");
	}

	/**
	 * 获取图片地址
	 **/
	public static String getStudentImg() {
		return prop.getProperty("image.student", "");
	}

	/**
	 * 11.27 不在本地配置，获取数据库配置的时间参数 // public static String getYYbefore() { //
	 * return prop.getProperty("yybefore", ""); // } // // public static String
	 * getYYlast() { // return prop.getProperty("yylast", ""); // }
	 **/

	/**
	 * 保存文件路径
	 **/
	public static String getFileImg() {
		return prop.getProperty("file.zs", "");
	}

	/**
	 * 保存上传文件
	 **/
	public static String getFileLog() {
		return prop.getProperty("file.appLog", "");
	}
	
	/**
	 * 获取文件路径
	 **/
	public static String getFilesImg() {
		return prop.getProperty("file.zss", "");
	}
	
	/**
	 * 获取学习结果文件路径
	 **/
	public static String getStudyRecordSave() {
		return prop.getProperty("studyRecord.save", "");
	}


	// 科目二对应配置表
	public static String getSubjectTWO() {
		return prop.getProperty("subjectONE", "");
	}

	// 科目三对应配置表
	public static String getSubjectTHREE() {
		return prop.getProperty("subjectTHREE", "");
	}

	/**
	 * 获取异常地址
	 **/
	public static String getExceptionPath() {
		return prop.getProperty("exception", "");
	}

	/**
	 * 获取定时时间 （分钟）
	 **/
	public static String getRemindMinute() {
		return prop.getProperty("remindMinute", "5");
	}
	
	/**
	 * 获取视频系数
	 **/
	public static String getStudyRatio() {
		return prop.getProperty("study.ratio", "");
	}
	
	
	/**
	 * 获取模考学时最大统计时长
	 **/
	public static String getStudyMaxTime() {
		return prop.getProperty("study.maxtime", "");
	}
	
	
	/**
	 * 获取验证登录登出URL
	 **/
	public static String getChekUrl() {
		return prop.getProperty("check.url", "");
	}
	
	

	// 去除所有 科目对应的配置
	static Map<String, String> subject;

	public static Map<String, String> getSubjectMap() {
		subject = new HashMap<String, String>();
		String s1 = prop.getProperty("1", "");
		String s2 = prop.getProperty("2", "");
		String s3 = prop.getProperty("3", "");
		String s4 = prop.getProperty("4", "");
		String s5 = prop.getProperty("5", "");
		String s6 = prop.getProperty("6", "");
		String s7 = prop.getProperty("7", "");
		String s8 = prop.getProperty("8", "");
		String s9 = prop.getProperty("9", "");
		String s10 = prop.getProperty("10", "");
		String s11 = prop.getProperty("11", "");
		String s12 = prop.getProperty("12", "");
		String s13 = prop.getProperty("13", "");
		String s14 = prop.getProperty("14", "");
		String s15 = prop.getProperty("15", "");
		subject.put("1", s1);
		subject.put("2", s2);
		subject.put("3", s3);
		subject.put("4", s4);
		subject.put("5", s5);
		subject.put("6", s6);
		subject.put("7", s7);
		subject.put("8", s8);
		subject.put("9", s9);
		subject.put("10", s10);
		subject.put("11", s11);
		subject.put("12", s12);
		subject.put("13", s13);
		subject.put("14", s14);
		subject.put("15", s15);
		return subject;
	}
	/**
	 * 获取发送验证码地址
	 **/
	public static String getSendCodeServerUrl() {
		return prop.getProperty("SendCodeServerUrl", "");
	}
	
	/**
	 * 获取验证验证码地址
	 **/
	public static String getVerifyCodeServerUrl() {
		return prop.getProperty("VerifyCodeServerUrl", "");
	}
	/**
	 * 获取短信APP_KEY
	 **/
	public static String getSMSAPPKey() {
		return prop.getProperty("SMSAPP_KEY", "");
	}
	/**
	 * 获取短信APP_SECRET
	 **/
	public static String getSMSAPPSecret() {
		return prop.getProperty("SMSAPP_SECRET", "");
	}
	
	/**
	 * 获取随机数NONCE
	 **/
	public static String getNonce() {
		return prop.getProperty("NONCE", "");
	}
	
	/**
	 * 获取验证码长度
	 **/
	public static String getCodelen() {
		return prop.getProperty("CODELEN", "");
	}
	
	/**
	 * 获取支付宝支付URL
	 **/
	public static String getAlipayUrl() {
		return prop.getProperty("AlipayUrl", "");
	}
	/**
	 * 获取支付宝支付URL
	 **/
	public static String getAlipayAppId() {
		return prop.getProperty("AlipayAppId", "");
	}
	/**
	 * 获取RSA密钥
	 **/
	public static String getRSASecret() {
		return prop.getProperty("RSASecret", "");
	}
	
	/**
	 * 获取支付公钥
	 **/
	public static String getAlipayKey() {
		return prop.getProperty("AlipayKey", "");
	}
	
	/**
	 * 获取异步通知地址
	 **/
	public static String getNotifyUrl() {
		return prop.getProperty("NotifyUrl", "");
	}
	/**
	 * 获取微信支付APPID
	 **/
	public static String getWXPayAppId() {
		return prop.getProperty("WXPayAppId", "");
	}
	/**
	 * 获取商户号
	 **/
	public static String getMchId() {
		return prop.getProperty("mch_id", "");
	}
	/**
	 * 获取商户号
	 **/
	public static String getWXNotifyUrl() {
		return prop.getProperty("notifyurl", "");
	}
	/**
	 * 获取商户key
	 **/
	public static String getWXkey() {
		return prop.getProperty("wx_key", "");
	}
	/**
	 * 获取商户统一下单URL
	 **/
	public static String getWXPayUrl() {
		return prop.getProperty("WXPayUrl", "");
	}

}
